const { defineConfig } = require('@vue/cli-service')

const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}


module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  devServer: {
    proxy: {
      // 配置跨域
      '/devPlat': { 
        target: 'https://dev-hsedemo.joysuch.com:18443',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/devPlat': '',
        },
      },
      '/testPlat': { 
        target: 'https://test-hsedemo.joysuch.com:19443',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/testPlat': '',
        },
      },
      '/devManage': { 
        target: 'http://172.16.10.46:9090/',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/devManage': '',
        },
      },
      '/testManage': { 
        target: 'http://192.168.0.213:9090/',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/testManage': '',
        },
      },
    },
    client: { // 隐藏红色遮罩提示
      overlay: false,
    },
  },
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src'),
      }
    }
  }
})
